<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script>
		var _YS = _YS || [];
		_YS.push(['Url','http://127.0.0.1:3000/users?']);
		// 收集的平台 host，默认不需要配置
		_YS.push(['systemName','myWap']);
		// 用户自定义收集字段
		_YS.userConfig = {
			author: '白云飘飘'
		};
		_YS.push(['_setAccount', 'YS-Test-1']);
		//_YS.push(['Action','Title']);
		_YS.push(['Target','a','div','button']);
		_YS.syserror = [];
		//记录客户端脚本错误 
		window.onerror = function(error) {
		try { 
			var msg; 
			for (var i = 0; i < arguments.length; i++) { 
				if (i == 0 || i == 2) { 
					msg += " | " + arguments[i]; 
				} 
			} 
			if (msg.length > 0 ) { 
				_YS.syserror.push('syserror:'+msg);
			} 
			return true; 
		} catch (e) { }; 
		};  
   </script>
    <script src="./collect.js"></script>
</head>

<body>
	<input type="button" value="test" onclick="test1()">
	<a href="#" onclick="test2()">tttt</a>
    <script>
		function test1() {
			console.log("in test1 jkk");
		}
		function test2() {
			console.log("in test2 8uuuuu");
		}
        throw new Error("error hjj83883");
    </script>
</body>
<script>
(function() {
	var collect = document.createElement('script');
	collect.type = 'text/javascript';
	collect.async = true;
	// collect.js 所在的地址。如果是在本地直接改成本地地址；如果是在第三方服务器上，该第三方必须提供 http 和 https 地址。
	collect.src = ('https:' == document.location.protocol ? 'https://' : 'http://127.0.0.1:8000') + '/demo1/collect.js';
	var s = document.getElementsByTagName('script')[0];
	s.parentNode.insertBefore(collect, s);
})();
</script>
</html>